Skip to content

Add browser build for html-wrapper package#134

Merged
danmarshall merged 5 commits into
mainfrom
copilot/make-browser-build-html-wrapper
Nov 14, 2025
Merged

Add browser build for html-wrapper package#134
danmarshall merged 5 commits into
mainfrom
copilot/make-browser-build-html-wrapper

Conversation

Copilot AI commented Oct 30, 2025

Copy link
Copy Markdown
Contributor

The html-wrapper package lacked a browser UMD build like other packages in the repo (compiler, toolbar, sandbox, host, markdown, editor).

Changes

  • Created umd.ts entry point - Exports htmlWrapper module from src-server/index following existing package pattern
  • Created vite.bundle.config.js - Builds UMD bundle to dist/umd/ and docs/dist/v1/
  • Updated package.json - Added bundle script, integrated with workspace build
  • Updated .gitignore - Excluded dist/umd/

Output

docs/dist/v1/chartifact.html-wrapper.umd.js (6.19 KB)

Usage

<script src="chartifact.html-wrapper.umd.js"></script>
<script>
  const html = Chartifact.htmlWrapper.htmlMarkdownWrapper('My Title', '# Hello World');
  // or
  const htmlJson = Chartifact.htmlWrapper.htmlJsonWrapper('My Title', '{"title": "test"}');
</script>

The bundle exports the server-side HTML wrapper functions (htmlMarkdownWrapper and htmlJsonWrapper) and extends the global Chartifact namespace. It runs automatically with npm run bundle from workspace root.

Original prompt

make a browser build of html-wrapper, following the pattern like others in the repo, deploy to docs/dist/v1


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits October 30, 2025 03:24
Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
Copilot AI changed the title [WIP] Make browser build of html-wrapper for deployment Add browser build for html-wrapper package Oct 30, 2025
Copilot AI requested a review from danmarshall October 30, 2025 03:31
@danmarshall

Copy link
Copy Markdown
Collaborator

@copilot you can delete your packages/html-wrapper/src/index.ts entirely. Your umd.ts should just export src-server/index

Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>

Copilot AI commented Oct 30, 2025

Copy link
Copy Markdown
Contributor Author

@copilot you can delete your packages/html-wrapper/src/index.ts entirely. Your umd.ts should just export src-server/index

Done. Deleted packages/html-wrapper/src/index.ts and updated umd.ts to export from src-server/index instead. The UMD bundle now exports htmlMarkdownWrapper and htmlJsonWrapper functions. (commit 3b10141)

@danmarshall danmarshall marked this pull request as ready for review October 30, 2025 04:32
@danmarshall danmarshall merged commit 53ff66c into main Nov 14, 2025
6 checks passed
@danmarshall danmarshall deleted the copilot/make-browser-build-html-wrapper branch November 14, 2025 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants